
#include "talkui.h"

TalkUI::TalkUI(QObject *parent) : QObject(parent)
{

}
QString TalkUI::setPushButtonQss(QPushButton *btn)
{
    QStringList list;
    list.append(QString("QPushButton{background:#397ceb;padding:8px;border-radius:5px;color:#FFFFFF;border-style:none;}"));
    list.append(QString("QPushButton:pressed{color:#d4d4d4;background:#3069c7;}"));
    list.append(QString("QPushButton:hover{color:#FFFFFF;background:#397ceb;}"));
    QString qss = list.join("");
    btn->setStyleSheet(qss);
    return qss;
}
QString TalkUI::setPushTextButtonQss(QPushButton *btn)
{
    QStringList list;
    list.append(QString("QPushButton{padding:%1px;color:%2;background:%3;border-style:none;}").arg(8).arg("#FFFFFF").arg("#00000000"));
    list.append(QString("QPushButton:pressed{color:%1;}").arg("#d4d4d4"));
    QString qss = list.join("");
    btn->setStyleSheet(qss);
    return qss;
}

QString TalkUI::setContactListQss(ContactList *contactlist)
{
    QStringList list;
    list.append(QString("QListWidget{background:#ffffff;border:none;}"));
    list.append(QString("QListWidget::item{border:none;height: 54px;}"));
//    list.append(QString("QListWidget::item:hover{background:rgb(252,240,193)}"));
    list.append(QString("QListWidget::item:selected{background:#cce0ff;}"));
    list.append(QString("QScrollBar:vertical {background:transparent;width:9px;margin: 0px 0px 2px 0px;}"));
    list.append(QString("QScrollBar::handle:vertical {background: rgb(195, 195, 195);min-height: 20px;border-radius: 3px;}"));
    list.append(QString("QScrollBar::handle:vertical:hover{background:rgba(0,0,0,30%);}"));
    list.append(QString("QScrollBar::add-line:vertical {height: 0px;subcontrol-position: bottom;subcontrol-origin: margin;}"));
    list.append(QString("QScrollBar::sub-line:vertical {height: 0px;subcontrol-position: top;subcontrol-origin: margin;}"));

    QString qss = list.join("");
    contactlist->setStyleSheet(qss);
    return qss;
}
QString TalkUI::setTalkMsgListQss(TalkMsgList *talkMsgList)
{
    QStringList list;
    list.append(QString("QListWidget{border:none;}"));
    list.append(QString("QListWidget::item{border:none;height: 70px;}"));
//    list.append(QString("QListWidget::item:hover{background:rgb(252,240,193)}"));
//    list.append(QString("QListWidget::item:selected{background:#cce0ff;}"));
    list.append(QString("QScrollBar:vertical {background:transparent;width:9px;margin: 0px 0px 2px 0px;}"));
    list.append(QString("QScrollBar::handle:vertical {background: rgb(195, 195, 195);min-height: 20px;border-radius: 3px;}"));
    list.append(QString("QScrollBar::handle:vertical:hover{background:rgba(0,0,0,30%);}"));
    list.append(QString("QScrollBar::add-line:vertical {height: 0px;subcontrol-position: bottom;subcontrol-origin: margin;}"));
    list.append(QString("QScrollBar::sub-line:vertical {height: 0px;subcontrol-position: top;subcontrol-origin: margin;}"));

    QString qss = list.join("");
    talkMsgList->setStyleSheet(qss);
    return qss;
}
